/*
 * @Description:
 * @Author: Cxy
 * @Date: 2023-04-13 16:39:28
 * @LastEditors: Cxy
 * @LastEditTime: 2024-02-22 15:03:42
 * @FilePath: \blogAdmin\play\src\components\XyIcon\src\iconRender.tsx
 */
import iconCompon from './index'
import type { Component } from 'vue'

type AttrsInter = {
  // iconify (https://docs.iconify.design/icon-components/vue/#properties)
  inline?: boolean
  width?: string | number
  height?: string | number
  flip?: string
  rotate?: number | string
  color?: string
  verticalAlign?: boolean
  align?: string
  style?: object
}

export default function XyIconRender(icon: string, attrs?: AttrsInter): Component {
  return defineComponent({
    name: 'XyIconRender',
    render() {
      return h(iconCompon, {
        icon,
        ...attrs
      })
    }
  })
}
